<?php
/**
 * Created by PhpStorm.
 * User: alice
 * Date: 2016/1/14
 * Time: 11:06
 */

class Involved_HelpCenterModel extends BaseModel{

    protected $table = 'help_center';

    /**
     * 帮助中心列表
     * @author alice
     * @date 2016-1-19
     * @return mixed
     */
    public function ShowHelpList()
    {
        return DB::table($this->table)
            ->select('help_id','title')
            ->where('type',0)->orderBy('help_id','asc')->get();
    }

    /**
     * 关于木投
     * @return mixed
     */
    public function GetAboutInfo()
    {
        DB::table($this->table)->where('type', 3)->increment('views',1);
        return DB::table($this->table)->where('type', 3)->first();
    }

    /**
     * 常见问题
     * @return mixed
     */
    public function GetHotHelpList()
    {
        return DB::table($this->table)
            ->select('help_id','title')
            ->where('type',1)->orderBy('views','desc')->limit(5)->get();
    }

    /**
     * 帮助中心详情
     * @param $help_id
     * @return mixed
     */
    public function GetHelpInfo($help_id)
    {
        DB::table($this->table)->where('help_id', $help_id)->increment('views',1);
        return DB::table($this->table)->where('help_id', $help_id)->first();
    }

}